{extend name="public:base"}
{block name='css'}
{/block}

{block name='body'}
<div class="view view-main white-navbar white-toolbar">
    <div data-name="home" class="page">

        <div class="navbar">
            <div class="navbar-inner">
                <div class="left"><a href="{$my_prev_url|default='/'}" class="external"><i class="iconfont icon-fanhui"></i></a></div>
                <div class="center"><span>提现记录</span></div>
                <div class="right"></div>
            </div>
        </div>

        <div class="page-content infinite-scroll-content">

            <div class="list tx-list">
                <ul>
                </ul>
            </div>

            {include file='public:loading' /}

        </div>


    </div>
</div>
{/block}

{block name="js"}
<script>
    function getList() {
        var total = $('.tx-list li').length;
        if (total % 10 != 0) {
            return false;
        }

        if ($('.loading').is(':visible') || $('.no-more').is(':visible') || $('.no-data').is(':visible')) {
            return false;
        }
        $('.loading').show();

        var p = total / 10;
        $.post("{:url('getWithdrawList')}", {page:p+1, user_type:"{:input('user_type', 0, 'intval')}"}, function(data){
            var str = '';
            $('.loading').hide();
            if (data.data.data.length > 0) {
                $.each(data.data.data, function(i,n){
                    str += '<li>\n' +
                        '    <a href="{:url("withdraw_info")}?id='+n.id+'" class="external item-content">\n' +
                        '        <div class="item-inner">\n' +
                        '            <div class="item-title">\n' +
                        '                <span>'+n.bank+'</span>\n' +
                        '                <div class="item-footer">尾号：'+n.card.substr(-4,4)+'</div>\n' +
                        '            </div>\n' +
                        '            <div class="item-title y">\n' +
                        '                <span>￥'+n.amount+'</span>\n' +
                        '                <div class="item-footer">'+n.state+'</div>\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '    </a>\n' +
                        '</li>';
                });
                if (data.data.data.length < 10) {
                    $('.no-more').show();
                }
                $(str).appendTo($('.tx-list ul'));
            } else {
                if (total > 0) {
                    $('.no-more').show();
                } else {
                    $('.no-data').show();
                }
            }
        }, 'json');
    }
    $(function(){
        getList();
    });
    //触发无限滚动
    $$('.infinite-scroll-content').on('infinite', function () {
        getList();
    });
</script>
{/block}